﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////


#pragma once        
#include "IFamilyDimensionConstraint.h"
#include "GmFamilyService.h"

namespace gfam
{

    /// \brief  距离约束
    class GM_FAMILY_SERVICE_EXPORT IFamilyDistanceConstraint : public IFamilyDimensionConstraint
    {
        DEFINE_CAST_DERIVED(gfam::IFamilyDistanceConstraint, gfam::IFamilyDimensionConstraint)
    public:
        /// \brief  创建距离约束
        ///
        /// \param  pDocument  文档
        /// \param  sketchId 草图id
        /// \param  option  创建选项
        /// \return 距离约束
        static IFamilyDistanceConstraint* Create(gcmp::IDocument* pDocument, const gcmp::ElementId& sketchId, gcmp::ElementCreationOptions option = gcmp::ElementCreationOptions::Normal);


        /// \brief  创建距离约束
        ///
        /// \param  pDocument  文档
        /// \param  sketchId 草图id
        /// \param  sketchPlaneId 草图平面id
        /// \param  ownerId 拥有者id(目前只支持IFamilyMultiDistanceDimension类)
        /// \param  coord 坐标系
        /// \param  option  创建选项
        /// \return 距离约束
        static IFamilyDistanceConstraint* Create(
            gcmp::IDocument* pDocument
            , const gcmp::ElementId& sketchId
            , const gcmp::ElementId& sketchPlaneId
            , const gcmp::ElementId&ownerId
            , const gcmp::Coordinate3d& coord
            , gcmp::ElementCreationOptions option = gcmp::ElementCreationOptions::Normal
        );

        /// \brief  获取是否是投影距离
        ///
        /// \return 投影距离返回true，否则返回false
        virtual bool IsProjDistance() const = 0;

        /// \brief  更新标注尺寸值
        ///
        virtual void CalcDimValue() = 0;

        /// \brief  设置拥有者id (目前只支持IFamilyMultiDistanceDimension类)
        ///
        /// \param ownerId  拥有者id
        virtual void SetOwnerId(const gcmp::ElementId& ownerId) = 0;

        /// \brief  获取拥有者id (目前只支持IFamilyMultiDistanceDimension类)
        ///
        /// \return 拥有者id
        virtual gcmp::ElementId GetOwnerId() const = 0;

    };
}